package com.qcby.hengxiang.learn.controller;

import com.qcby.hengxiang.learn.entity.SiteAccessCount;
import com.qcby.hengxiang.learn.entity.User;
import com.qcby.hengxiang.learn.entity.UserVo;
import com.qcby.hengxiang.learn.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequestMapping("index")
    @ResponseBody
    public List<SiteAccessCount> index(UserVo userVo){
        List<SiteAccessCount> siteAccessCount = userService.getSiteAccessCount();
        return siteAccessCount;
    }
    @RequestMapping("getUser")
    @ResponseBody
    public User getUser(String userName){
        User user = userService.getUser(userName);
        return user;
    }
}
